package com.mc.charset;

import java.nio.charset.Charset;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.SortedMap;

public class TestCharset {
	
	public static void execute(){
		SortedMap<String,Charset> map = Charset.availableCharsets();
		Iterator<Entry<String,Charset>> iter = map.entrySet().iterator();
		while(iter.hasNext()){
			Entry<String,Charset> entry = iter.next();
			System.out.println(entry.getKey());
		}
	}
	public static void testEncode(){
		byte[] encode = "hello马超".getBytes(Charset.forName("utf-8"));
		String str = new String(encode,Charset.forName("gbk"));
		System.out.println(str);
	}
	public static void main(String[] args){
		TestCharset.testEncode();
	}
}
